package fem2.gui.actions;

import fem2.gui.Viewer;
import inf.vtk.uiswing.HardCopyDialog;

import java.awt.Frame;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.KeyStroke;

public class SaveImageAction extends AbstractAction {

	private static final long serialVersionUID = 1L;

	HardCopyDialog saveImageDialog1_;

	public SaveImageAction() {
		super("Save Image");
		putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("ctrl I"));
	}

	public void actionPerformed(ActionEvent e) {
		if (saveImageDialog1_ == null) {
			Viewer v = (Viewer) Frame.getFrames()[0];

			saveImageDialog1_ = new HardCopyDialog(v, v.getCanvas());
		}
		saveImageDialog1_.setVisible(true);
	}
}